# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Kaiting Chen <kaitocracy@gmail.com>
# Contributor: Martin Häger <martin.haeger@gmail.com>

pkgname=liboauth
pkgver=1.0.3+14+g186fb14
pkgrel=2
pkgdesc="C library implementing OAuth Core RFC 5849"
url="https://github.com/x42/liboauth"
arch=(x86_64)
license=(MIT)
depends=(curl nss)
makedepends=(git)
_commit=186fb14843c1bc98b70ece02c74b5696b3de9ce7  # master
source=("git+$url#commit=$_commit")
sha256sums=('SKIP')

prepare() {
  cd $pkgname
  autoreconf -fvi
}

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^v//;s/-/+/g'
}

build() {
  cd $pkgname
  ./configure --prefix=/usr --disable-static --enable-nss
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  cd $pkgname
  make check
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install
  install -Dm644 COPYING.MIT "$pkgdir/usr/share/licenses/$pkgname/COPYING"
}
